package com.starfactory.customer.controller;

import com.starfactory.common.shared.ResponseInfo;
import com.starfactory.customer.api.GetCustomDetailApi;
import com.starfactory.customer.shared.dto.CustomUserVo;
import com.starfactory.customer.shared.dto.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class GetCustomDetailApiController1 {
  @Autowired private GetCustomDetailApi getCustomDetailApi;

  @PostMapping("customer/api/aaa")
  public ResponseInfo<CustomUserVo> getCustomDetailApiApiFunction(
      @RequestParam String customUser) {
    Result<CustomUserVo> result = getCustomDetailApi.getCustomDetailApiApiFunction(customUser);
    if (result.getCode() == 200) {
      log.info("result:{}", result);
      return ResponseInfo.success(result.getData());
    } else {
      return ResponseInfo.fail(String.valueOf(result.getCode()), result.getMessage());
    }
  }
}
